<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

class BooksController extends AppController {

    var $name = 'Books';
    var $helpers = array('Html', 'Paginator');
    var $components = array('Session','Math');
    var $paginate = array();
    function paging() {
        $this->paginate = array(
            'field' => array('id', 'isbn', 'title'),
            'limit' => 4,
            'order' => 'Book.title DESC',
        );
        $data = $this->paginate('Book');
        $sum = $this->Math->addNumber(1,100);
        $this->set('sum', $sum);
        $this->set('data', $data);
    }
    function databook($category_id = 1) {
        $books = $this->Book->find('all', array(
            'conditions' => array(
                'category_id' => $category_id,
            ),
                ));
        $this->set('books', $books);
    }
}

?>
